package one.jieyun.ajzw.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.LoopPagerAdapter;

import java.util.List;

import one.jieyun.ajzw.module.ListViewSubItem;

/**
 * Created by Administrator on 2016/8/31.
 */
public class NewsAdapter extends LoopPagerAdapter {
    List<ListViewSubItem> list;
    public void setLists(List<ListViewSubItem> list){
        this.list = list;
        notifyDataSetChanged();
    }

    public NewsAdapter(RollPagerView viewPager) {
        super(viewPager);
    }

    @Override
    public View getView(ViewGroup container, int position) {
        final Context context = container.getContext();
        TextView textView = new TextView(context);
        ListViewSubItem slider= list.get(position);
        textView.setText(slider.getTitle());

        return textView;
    }

    @Override
    public int getRealCount() {
        if(list == null){
            return 0;
        }
        return list.size();
    }
}
